/**
 * Created by su on 2018/1/20.
 */
var btn = document.getElementById('sign');
var close = document.getElementById('close');
var modal = document.getElementById('sign-box');
var days = 0;
btn.addEventListener('click', function(){
    modal.style.display = "block";
});
close.addEventListener('click', function(){
    modal.style.display = "none";
});
var tmp = '';
var left = [3.4,8.7,13.85,5.75,11.3];
var img = [1.6,1.6,1.8];
var img1 = 'dotWhite.png';
var num = 1;
for(var i=0; i<4; i++) {
    if(i == 3) {
        num = 5;
        var img1 = 'starsWhite.png';
    }
    tmp += `<div class="sign-top-content">
                        <img id="one_img`+(i+1)+`" src="img/`+img1+`">
                        <span> `+(num++)+`0 金豆</span>
                    </div>`;
    if (i != 3) {
        tmp += `<img id="line_img`+(i+1)+`" src="img/sign-line.png" class="sign-success-line"  style="left: `+left[i]+`rem">`;
    }
}
$('#sign-stars-top').html(tmp);
tmp = '';
img1 = 'dotWhite.png';
for(var i=4; i<7; i++) {
    if(i == 6) {
        num =10;
        var img1 = 'starsWhite.png';
    }
    tmp += `<div class="sign-top-content">
                        <img id="one_img`+(i+1)+`" src="img/`+img1+`" style="width:`+img[i-4]+`rem">
                        <span> `+(num++)+`0 金豆</span>
                    </div>`;
    if(i != 6) {
        tmp += `<img id="line_img`+(i+1)+`" src="img/sign-line.png" class="sign-success-line"  style="top: 4.9rem;left: `+left[i-1]+`rem">`;
    }
}
console.log(tmp)
$('#sign-stars-bottom').html(tmp);
$("#sign-confirm").click(function () {
    days++;
    if (days ==4|| days ==7) {
        $('#one_img'+days).attr('src','img/starsY.png');
    } else {
        $('#one_img'+days).attr('src','img/dotY.png');
    }
    $('#line_img'+days).show();
    setTimeout(function () {
        $(".sign-box-title-success").show();
        $(".sign-box-title").hide();
        $(".sign-success-box").show();
        $(".sign-box-content").hide();
    },3000)


})